﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FACUI.BasicClass
{
    public class Digit2Item
    {
        public Digit digit;
        public bool isLogic;
        public Sharp item;
        public string notFountNameInLogicDigit;

        public Digit2Item(Digit digit, Sharp item, bool isLogic)
        {
            this.digit = digit;
            this.item = item;
            this.isLogic = isLogic;
        }

        public Digit2Item(Digit digit, string notFountNameInLogicDigit, bool isLogic)
        {
            this.digit = digit;
            this.item = null;
            this.notFountNameInLogicDigit = notFountNameInLogicDigit;
            this.isLogic = isLogic;
        }

        public override string ToString()
        {
            if (this.isLogic || (this.item == null))
            {
                return (StringUtil.TrimAndPadRight4ASCII(this.digit.name, 10) + " 逻辑开关量中[" + this.notFountNameInLogicDigit + "]未找到!");
            }
            if (!(this.isLogic || !this.digit.isLogic))
            {
                return (StringUtil.TrimAndPadRight4ASCII(this.digit.name, 5) + "[逻辑] " + this.item.ToString());
            }
            return (StringUtil.TrimAndPadRight4ASCII(this.digit.name, 5) + " " + this.item.ToString());
        }
    }
}

